{% extends '/pg/index.html' %}
{% block operation %}

<ul class="breadcrumb">
  <li><a href="/pg">Home</a></li>
  <li><a href="/pg/parametri">Parametri</a></li>
  <li class="active">Anagrafica Enti</li>
</ul>
<h2 class="text-center">Enti</h2>

{% include "pg/btn_action.html" with context %}

{% include "pg/filterkey/fk_rilevazioni.html" with context %}

{%endblock%}

{% block custom_js %}
<script type="text/javascript">
$(document).ready(function () {

$(".Preview").hide()
$("#anteprima").hide()
$(".Edit_dao").hide()
$("#edit_dao").hide()
$("#print_dao").hide()
$("#iconaricerca").hide()

$('#tableContainer_ac').jtable({
    title: 'Tabella Enti',
    messages: window.italianMessages,
    paging: true,
    pageSize: 20,
    sorting: true,
    defaultSorting: 'denominazione ASC',
    selecting: true,
    create:false,

            actions: {
                listAction: '/pg/as_Ente/List',
                deleteAction: '/pg/as_Ente/Delete'
            },
            fields: {
                id: {
                    key: true, create: false, edit: false, list: false },
                codice: {
                    title: 'Codice',
                    width: '8%',
                    create: false, edit: false,
                },
                denominazione: {
                    title: 'Denominazione',
                    width: '28%',
                    inputClass: 'validate[required,scroll=false,maxSize[99]]'
                },
                denominazione_breve: {
                    title: 'Denominazione Breve',
                    width: '28%',
                    inputClass: 'validate[required,scroll=false,maxSize[10]]'
                },
                lati: {
                    title: 'Latitudine',
                    width: '20%',
                },
                longi: {
                    title: 'Longitudine',
                    width: '20%',
                },
                id_tipo: {
                    title: 'Tipo Ente',
                    width: '19%',
                    options: '/pg/as_Ente/GetTipoEnte',
                },
                active: {width: '5%',title: 'Attivo',type: "checkbox", values: { 'false': 'Non Attivo', 'true': 'Attivo' },defaultValue: 'true',},

    },
    selectionChanged: function () {
    //Get all selected rows

    var $selectedRows = $('#tableContainer_ac').jtable('selectedRows');
    $("#anteprima").hide();
    $('.Preview').empty();
    $("#print_dao").hide();
    $("#edit_dao").hide();

    if ($selectedRows.length > 0) {
        //Show selected rows
        $("#edit_dao").show()
        $("#anteprima").show()
        //$("#print_dao").show()

    }
},
});

filtra = function() {
    $('#tableContainer_ac').jtable('load', {
        fk_denominazione: $('#fk_denominazione').val(),
        });
    }



$('#tableContainer_ac').jtable('load');
$('#anteprima').attr('preview', '/pg/as_Ente/Preview');
$('#new_dao').attr('nuovo_dao', '/pg/as_Ente/Edit');
$('#edit_dao').attr('modifica_dao', '/pg/as_Ente/Edit');

});
</script>
{% endblock %}
